package com.binarysoft.service.common.snmp;

import java.io.IOException;

import org.snmp4j.Snmp;
import org.snmp4j.TransportMapping;
import org.snmp4j.transport.DefaultUdpTransportMapping;

public class SnmpResouceImpl implements SnmpResouce {
	private Snmp snmp = null;
	private TransportMapping transportMapping = null;

	public SnmpResouceImpl() {
		super();
	}

	@Override
	public void open() throws Exception {
		transportMapping = new DefaultUdpTransportMapping();
		snmp = new Snmp(transportMapping);
		transportMapping.listen();
	}

	@Override
	public void close() {
		try {
			snmp.close();
			transportMapping.close();
		} catch (IOException e) {
		}
	}

	@Override
	public boolean isUsed() {
		return false;
	}

	@Override
	public void setUsed(boolean used) {
	}

	@Override
	public Snmp getSnmp() {
		return snmp;
	}

}
